package com.ruoyi.common.pay;

import java.net.InetAddress;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;

public class WXPayTest {
	 public static void main(String[] args) throws Exception {

	        MyConfig config = new MyConfig();
	        WXPay wxpay = new WXPay(config);
	        String ip = InetAddress.getLocalHost().getHostAddress();
//	        SortedMap<String, String> data =  new TreeMap<String, String>();
	        Map<String, String> data = new HashMap<String, String>();
		 SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
	        data.put("partner_trade_no", sdf.format(new Date() )+new Date().getTime());
	        data.put("check_name", "NO_CHECK");
		 data.put("openid", "CNY");
		 data.put("desc", "提现");
	        data.put("amount", "1");
	        data.put("trade_type", "APP");  // 此处指定为扫码支付

	        try {
	            Map<String, String> resp = wxpay.transfers(data);
	            System.out.println(resp);
	        } catch (Exception e) {
	            e.printStackTrace();
	        }
	    }
}
